import Vue from 'vue'
import VueRouter from 'vue-router'
import main from '../views/main.vue'
import homeMain from "../views/home/homeMain";
import aboutMain from "../views/jianjie/aboutMain";
import workCard from "../views/jianjie/workCard";
import wenhCard from "../views/jianjie/wenhCard";
;

Vue.use(VueRouter);

  const routes = [
    {
      path:'/',
      redirect:'/main'
    },
    {
      path: '/main',
      component:main,
      redirect: '/home',
      children:[
        {path:'/home',component:homeMain},
        {
          path:'/about',
          redirect:'/about/intro',
          component: aboutMain,
          children:[
            {path:'/about/intro',component:workCard},
            {path:'/about/culture',component: wenhCard}
          ]
        },
        {path:'/service',component:()=>import('../views/services/service')},
        {path:'/knowledge/:id',component:()=>import('../views/knowlage/Knowledge')},
        {path:'/Results/:id',component:()=>import('../views/success/Results')},
        {path:'/item/:id',component:()=>import('../views/success/resultsDetail')},
        {path:'/news/:id',component:()=>import('../views/news_center/newsMain')},
        {path:'/newList/:id',component:()=>import("../views/news_center/newsList")}
      ]
    }

];

const router = new VueRouter({
  routes
});

//每次页面跳转滚动条置顶
router.afterEach((to, from, next)=> {
  window.scrollTo(0, 0);
});
export default router
